﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace FrameDisplayServer.UI.Settings
{
    public partial class PickAccessCodeForm : Form
    {
        public PickAccessCodeForm()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (AppCentral.IsInitialized)
            {
                this.textBoxAccessCode.Text = AppCentral.SettingsManager.AccessCode;
            }
        }

        private void buttonCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (this.textBoxAccessCode.Text.Length > 0)
            {
                AppCentral.SettingsManager.AccessCode = this.textBoxAccessCode.Text;

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
    }
}
